home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
aie8911.zip
/
TALK
< prev
next >
Wrap
Text File
|
1989-07-30
|
5KB
|
309 lines
AI_SL/1
AI IN THE SYSTEM LIFECYCLE
1. DEBUGGING
2. SPECIFICATION
Today's talk restricted to
procedural systems
AI_SL/2
DEBUGGING
* 2 SUBPROBLEMS:
LOCATING THE BUG
FIXING IT
-- ONLY TALK ABOUT LOCATING TODAY
LOCATION METHOD:
1. PUT IN SIGNPOSTS
2. RUN PROGRAM
3. LOOK AT TRACE MESSAGES
SHOWING EXECUTION TRAIL
AI_SL/3
PROGRAMS THAT STOP WHEN THEY
FAIL ARE EASY LOCATE ERROR
REGION IN
* Put in signposts thru prog.
Get notices as program runs.
* When program stops,
this output stops.
* Look at the end of the trace
output to see where failure
stops the program.
Now, an example:
AI_SL/4
* PROLOG MAKES STOP AT FAILURE EASY
* BUT WE CAN ALSO DO IT IN PASCAL
-- see listing on machine
AI_SL/5
* SIGNPOST DEBUGGING IS SUCCESSIVE
REFINEMENT
-- HAVE TO LOCATE PART OF PROGRAM
TO PUT IN SIGNPOSTS
AI_SL/6
DIVIDE AND CONQUER STRATEGY
1. Find out what part of prog.
bug is in.
2. Repeat process on that part.
3. Continue until you have the
bug confined to a little
section of code.
4. Recognize it.
AI_SL/7
* D & C WITH THE COMPUTER:
-- THE COMPUTER DOES WHAT YOU DO
1. Run program with a system
module that saves info.
2. Let an expert system analyze
this info from the run.
3. Have the expert system decide
what part of the prog. has
the bug.
4. Repeat process on that part.
5. Continue until you have the
bug confined to a little
section of code.
6. Produce a report for the
user.
AI_SL/8
IMPLEMENTATION OF THIS IN PROLOG
-- FIRST, A DEMO ON A BUGGY PROGRAM:
integers( []) :- !,
fail.
integers( [H|T]) :-
integer(H),
integers(T).
HOW WE DID THIS:
* ONE LEVEL AT A TIME
* FIND FAILING CALL IN EACH
PROCEDURE BODY
* THEN DO THE SAME ON THE BODY
OF THE CALLED PROCEDURE
AI_SL/9
WHAT TO DO AT EACH LEVEL:
1. GET RULES OF FAILING PREDICATE
2. RUN PREDICATE, OBSERVING HOW
EACH RULE DOES:
FRAME subgoal_result
call : integers([1])
clause_no : 1
head_matched : fail
END_FRAME
FRAME subgoal_result
call : integers([1])
clause_no : 2
result : fail
failing_subgoal_number : 2
failing_subgoal : integers([])
head_matched : true
END_FRAME
(see code on machine)
AI_SL/10
CONDENSE THIS INTO A SUMMARY OF
WHAT HAPPENED FOR THE PREDICATE
AS A WHOLE:
FRAME goal_report
call : integers([1])
clause_no : 2
result : fail
failing_subgoal_number : 2
failing_subgoal : integers([])
END_FRAME
-- see example rule on machine
AI_SL/11
* DRIVE ANALYSIS DOWN A LEVEL
-- AS LONG AS REPORT AT PREV.
LEVEL SAYS WHERE TO GO
-- see code on machine:
AI_SL/12
THIS PRODUCES THE BUG INFO:
[ % start of bug path list
[ % start of first bug path
goal_report([
system_predicate : true,
result : fail,
call : fail,
reason : $You called fail$]),
goal_report([
call : integers([]),
clause_no : 1,
result : fail,
failing_subgoal_number : 2,
failing_subgoal : fail,
cuts_passed : 1 ]),
goal_report([
call : integers([1]),
clause_no : 2,
result : fail,
failing_subgoal_number : 2,
failing_subgoal : integers([]) ]),
goal_report([
failing_subgoal : integers([1])
source : user ])
] % end of only bug path
] % end of bug path list
AI_SL/13
THIS GETS TRANSLATED INTO A REPORT:
HERE IS THE BUG ANALYSIS :
THE TOP LEVEL BUG...
The user-supplied goal
integers([1]) failed.
GOING DOWN A LEVEL,
The goal at this level is
integers([1]) which failed.
Clause 2 of integers / 1 failed.
Here it is with the failing
subgoal marked.
integers([A|B]) :-
integer(A),
FAILS==>integers(B).
Instantiated, this subgoal
is integers([]).
AI_SL/14
REPORT, CONT.
GOING DOWN A LEVEL,
The goal at this level is
integers([]) which failed.
Clause 1 of integers / 1 failed.
Here it is with the failing
subgoal marked.
integers([]) :-
!,
FAILS==>fail.
Instantiated, this subgoal is
fail.
GOING DOWN A LEVEL,
You deliberately called
the predicate 'fail'.
-- ( end of this particular
possible bug explanation ) --
AI_SL/15
OBSERVATIONS:
* FRAMES ARE VERY USEFUL TO HOLD
WHAT YOU LEARN
* FRAMES FIT INTO PROLOG --
UNIFICATION EXTENDS TO FRAMES
* LOTS OF LITTLE EXPERT SYSTEMS
MODULARIZE THE PROBLEM
Used here:
-- single rule behavior
-- single predicate behavior
-- when to extend analysis
-- report production